package cn.maidouya.hrm.controller;
import cn.maidouya.hrm.util.AjaxResult;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 *   测试security自带登录页面
 */
@RestController
@RequestMapping
public class LoginController {
    @RequestMapping("/success") // 自动识别请求方式
    public AjaxResult success(){
        // 获取登录下信息
        String name = SecurityContextHolder.getContext().getAuthentication().getName();
        return AjaxResult.me().setMessage(name + "登录成功");
    }
}